home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / boot / czesc_2 / toolmanager / source / wbstartup / toolmanager.c < prev   
C/C++ Source or Header  |  1993-05-15  |  2KB  |  83 lines

  1. /*
  2.  * ToolManager.c  V2.1
  3.  *
  4.  * Start & quit ToolManager
  5.  *
  6.  * (c) 1990-1993 Stefan Becker
  7.  */
  8.  
  9. #include <clib/exec_protos.h>
  10. #include <clib/intuition_protos.h>
  11. #include <clib/locale_protos.h>
  12. #include <clib/toolmanager_protos.h>
  13. #include <pragmas/exec_pragmas.h>
  14. #include <pragmas/intuition_pragmas.h>
  15. #include <pragmas/locale_pragmas.h>
  16. #include <pragmas/toolmanager_pragmas.h>
  17. #include <stdlib.h>
  18. #define CATCOMP_NUMBERS
  19. #define CATCOMP_STRINGS
  20. #include "/locale/toolmanager.h"
  21.  
  22. extern struct Library *SysBase;
  23. extern struct Library *IntuitionBase;
  24. struct Library *ToolManagerBase; /* Supress DICE auto-open */
  25. struct Library *LocaleBase;
  26. struct EasyStruct es={sizeof(struct EasyStruct),0,"ToolManager",
  27.                       MSG_UTILITIES_QUITREQ_TEXT_STR,
  28.                       MSG_UTILITIES_QUITREQ_GAD_STR};
  29. const char VersionString[]="\0$VER: ToolManager_Starter 2.1 ("
  30.                            __COMMODORE_DATE__ ")";
  31.  
  32. /* CLI entry point */
  33. int main(int argc, char *argv[])
  34. {
  35.  struct Task *t;
  36.  
  37.  /* Find handler task */
  38.  Forbid();
  39.  t=FindTask("ToolManager Handler");
  40.  Permit();
  41.  
  42.  /* Now open library */
  43.  if (ToolManagerBase=OpenLibrary(TMLIBNAME,0)) {
  44.   /* Handler active? Yes, call quit function */
  45.   if (t) {
  46.    struct Catalog *Catalog=NULL;
  47.  
  48.    /* Try to open locale.library */
  49.    if (LocaleBase=OpenLibrary("locale.library",38)) {
  50.  
  51.     /* Try to get catalog for current language */
  52.     if (Catalog=OpenCatalog(NULL,"toolmanager.catalog",
  53.                             OC_BuiltInLanguage, "english",
  54.                             OC_Version,         3,
  55.                             TAG_DONE)) {
  56.      /* Get translation strings */
  57.      es.es_TextFormat=GetCatalogStr(Catalog,MSG_UTILITIES_QUITREQ_TEXT,
  58.                                     es.es_TextFormat);
  59.      es.es_GadgetFormat=GetCatalogStr(Catalog,MSG_UTILITIES_QUITREQ_GAD,
  60.                                       es.es_GadgetFormat);
  61.     }
  62.    }
  63.  
  64.    /* Show requester */
  65.    if (EasyRequestArgs(NULL,&es,NULL,NULL)) (void)QuitToolManager();
  66.  
  67.    /* Free locale stuff */
  68.    if (LocaleBase) {
  69.     if (Catalog) CloseCatalog(Catalog);
  70.     CloseLibrary(LocaleBase);
  71.    }
  72.   }
  73.   CloseLibrary(ToolManagerBase);
  74.  }
  75.  exit(0);
  76. }
  77.  
  78. /* WB entry point */
  79. int wbmain(struct WBStartup *wbs)
  80. {
  81.  return(main(0,0));
  82. }
  83.